<?php

namespace app\api\model;

use think\Model;
use think\model\relation\HasMany;
use think\model\relation\HasOne;

class CampusCourseOrderModel extends Model
{
    // 表名
    protected $name = 'campus_course_order';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;

    /**
     * 选课详情
     * @return HasOne
     */
    public function mallGoodsInfo(){
        return $this->hasOne(CampusCourseMallGoodsModel::class,'id','goods_id');
    }

    /**
     * 专项课订单详情
     * @return HasOne
     */
    public function managementOrderInfo(){
        return $this->hasOne(CampusCourseOrderSublevelModel::class,'no','no');
    }

    /**
     * 套餐课订单列表
     * @return HasMany
     */
    public function managementPackageOrderList(){
        return $this->hasMany(CampusCourseOrderSublevelModel::class,'no','no');
    }
}
